namespace GeoWeb.Demo.CodeValue
{
    using System;
    using GeoWeb.DataContext;


    /// <summary>
    /// 表名：CodeClassify 主键列：CodeClassifyOID
    /// </summary>
    [SerializableAttribute()]
    public partial class CodeClassify : Entity
    {

        protected Guid _CodeClassifyOID;

        protected String _CodeTableID;

        protected String _CodeTableName;

        protected Int32? _CodeLen;

        protected String _DivideRule;

        public Guid CodeClassifyOID
        {
            get
            {
                return this._CodeClassifyOID;
            }
            set
            {
                this.OnPropertyValueChange(_.CodeClassifyOID, _CodeClassifyOID, value);
                this._CodeClassifyOID = value;
            }
        }

        public String CodeTableID
        {
            get
            {
                return this._CodeTableID;
            }
            set
            {
                this.OnPropertyValueChange(_.CodeTableID, _CodeTableID, value);
                this._CodeTableID = value;
            }
        }

        public String CodeTableName
        {
            get
            {
                return this._CodeTableName;
            }
            set
            {
                this.OnPropertyValueChange(_.CodeTableName, _CodeTableName, value);
                this._CodeTableName = value;
            }
        }

        public Int32? CodeLen
        {
            get
            {
                return this._CodeLen;
            }
            set
            {
                this.OnPropertyValueChange(_.CodeLen, _CodeLen, value);
                this._CodeLen = value;
            }
        }

        public String DivideRule
        {
            get
            {
                return this._DivideRule;
            }
            set
            {
                this.OnPropertyValueChange(_.DivideRule, _DivideRule, value);
                this._DivideRule = value;
            }
        }

        /// <summary>
        /// 获取实体对应的表名
        /// </summary>
        protected override Table GetTable()
        {
            return new Table<CodeClassify>("CodeClassify");
        }

        /// <summary>
        /// 获取实体中的主键列
        /// </summary>
        protected override Field[] GetPrimaryKeyFields()
        {
            return new Field[] {
                        _.CodeClassifyOID};
        }

        /// <summary>
        /// 获取列信息
        /// </summary>
        protected override Field[] GetFields()
        {
            return new Field[] {
                        _.CodeClassifyOID,
                        _.CodeTableID,
                        _.CodeTableName,
                        _.CodeLen,
                        _.DivideRule};
        }

        /// <summary>
        /// 获取列数据
        /// </summary>
        protected override object[] GetValues()
        {
            return new object[] {
                        this._CodeClassifyOID,
                        this._CodeTableID,
                        this._CodeTableName,
                        this._CodeLen,
                        this._DivideRule};
        }

        /// <summary>
        /// 给当前实体赋值
        /// </summary>
        protected override void SetValues(IRowReader reader)
        {
            if ((false == reader.IsDBNull(_.CodeClassifyOID)))
            {
                this._CodeClassifyOID = reader.GetGuid(_.CodeClassifyOID);
            }
            if ((false == reader.IsDBNull(_.CodeTableID)))
            {
                this._CodeTableID = reader.GetString(_.CodeTableID);
            }
            if ((false == reader.IsDBNull(_.CodeTableName)))
            {
                this._CodeTableName = reader.GetString(_.CodeTableName);
            }
            if ((false == reader.IsDBNull(_.CodeLen)))
            {
                this._CodeLen = reader.GetInt32(_.CodeLen);
            }
            if ((false == reader.IsDBNull(_.DivideRule)))
            {
                this._DivideRule = reader.GetString(_.DivideRule);
            }
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            if ((obj == null))
            {
                return false;
            }
            if ((false == typeof(CodeClassify).IsAssignableFrom(obj.GetType())))
            {
                return false;
            }
            if ((((object)(this)) == ((object)(obj))))
            {
                return true;
            }
            return false;
        }

        public class _
        {

            /// <summary>
            /// 表示选择所有列，与*等同
            /// </summary>
            public static AllField All = new AllField<CodeClassify>();

            /// <summary>
            /// 字段名：CodeClassifyOID - 数据类型：Guid
            /// </summary>
            public static Field CodeClassifyOID = new Field<CodeClassify>("CodeClassifyOID");

            /// <summary>
            /// 字段名：CodeTableID - 数据类型：String
            /// </summary>
            public static Field CodeTableID = new Field<CodeClassify>("CodeTableID");

            /// <summary>
            /// 字段名：CodeTableName - 数据类型：String
            /// </summary>
            public static Field CodeTableName = new Field<CodeClassify>("CodeTableName");

            /// <summary>
            /// 字段名：CodeLen - 数据类型：Nullable`1
            /// </summary>
            public static Field CodeLen = new Field<CodeClassify>("CodeLen");

            /// <summary>
            /// 字段名：DivideRule - 数据类型：String
            /// </summary>
            public static Field DivideRule = new Field<CodeClassify>("DivideRule");
        }
    }
}
